//
//  ViewController.swift
//  AIGirl
//
//  Created by Rae on 2023/12/22.
//

import UIKit
import AVKit

class ViewController: UIViewController {

    var completion: (() -> Void)?

    override func viewDidLoad() {
        super.viewDidLoad()
        guard let path = Bundle.main.path(forResource: "launchVideo", ofType: "mov") else {
            return
        }
        let pl = AVPlayer(playerItem: AVPlayerItem(url: URL(fileURLWithPath: path)))
        let layer = AVPlayerLayer(player: pl)
        layer.videoGravity = .resizeAspectFill
        layer.frame = UIScreen.main.bounds
        view.layer.addSublayer(layer)
        pl.volume = 0
        pl.play()
        
        DispatchQueue.main.asyncAfter(deadline: .now()+4) {
            
            self.completion?()
        }
    }
}

